<?php

namespace App\Providers;

use InfluxDB2\Client;
use Illuminate\Support\ServiceProvider;

class InfluxServiceProvider extends ServiceProvider
{
    /**
     * Register services.
     *
     * @return void
     */
    public function register()
    {

        $this->app->singleton(Client::class, function ($app) {
            return new Client([
                "url" => env('INFLUX_URL'),
                "token" => env('INFLUX_TOKEN'),
                "bucket" => env('INFLUX_BUCKET'),
                "org" => env('INFLUX_ORG'),
                "precision" => \InfluxDB2\Model\WritePrecision::NS,
                "debug" => false
            ]);
        });
    }

    /**
     * Bootstrap services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }
}
